home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 8697 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  784 b 

  1. Path: news.pcix.com!root
  2. From: ed lizewski <elizewsk@capecod.net>
  3. Newsgroups: comp.lang.c++
  4. Subject: polymorphism and style
  5. Date: 26 Feb 1996 02:12:43 GMT
  6. Organization: Plymouth Commercial Internet eXchange
  7. Message-ID: <4gr4ur$n13@alpha.pcix.com>
  8. NNTP-Posting-Host: ost101.capecod.net
  9.  
  10.   Question on polymorphism and style.
  11. Want to call a function in a most derived class off a pointer to the base
  12. class. The fuction does not exist in the base class.
  13. I should:
  14. 1)downcast ?
  15. 2)add the function to the base class and add virtual stubs to every 
  16.   class that does not use it ? 
  17. 3)add it to the base class but define it like 
  18.      foo( ..whatever..) {error_msg("virtual function not defined");}
  19.   This way only the class that uses it would have to define it.
  20. 4) ?
  21.  
  22. thanks for your time.
  23.